package com.example.factory.test;

import com.example.factory.FactoryMethod;
import com.example.factory.Impi.AppleFactory;

import com.example.factory.Impi.BananaFactory;
import com.example.factory.father.FruitsBehavior;

/**
 * 工厂方法模式，一个工厂只生产一键产品
 */
public class User {
    public static void main(String[] args) {
        FactoryMethod appleFactory = new AppleFactory();
        FruitsBehavior apple = appleFactory.getProduct();
        apple.eat();

        FactoryMethod bananaFactory = new BananaFactory();
        FruitsBehavior banana = bananaFactory.getProduct();
        banana.eat();

    }
}
